package com.hl.qzzpbackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 融资阶段枚举
 * @author helong
 */
@Getter
public enum FundingStageEnum {
    PRE_FUNDING("未融资",0),
    ANGEL_ROUND("天使轮",1),
    A_ROUND("A轮",2),
    B_ROUND("B轮",3),
    C_ROUND("C轮",4),
    D_ROUND_PLUS("D轮以上",5),
    PUBLICLY_LISTED("已上市",6);

    private final String text;

    private final Integer value;

    FundingStageEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static FundingStageEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (FundingStageEnum fundingStageEnum : FundingStageEnum.values()) {
            if (fundingStageEnum.getValue().equals(value)) {
                return fundingStageEnum;
            }
        }
        return null;
    }
}
